<template>
  <div class="app-bg auto">
    <div  style=" padding-top:20px">
    <div class="col-xs-12">
      <span style="text-align: right;display:block;" class="col-xs-4">抄表人：</span><span class="col-xs-8">{{model.f_inputtor_name}}</span>
    </div>
    <div class="col-xs-12">
      <span style="text-align: right;display:block;" class="col-xs-4">公&nbsp;&nbsp;&nbsp;司：</span><span class="col-xs-8">{{model.f_fengongsi}}</span>
    </div>
    </div>
    <div style="text-align: center;margin-top:50px">
        <button style="width:130px;height:80px;" @click="$goto('state-yingchao',{f_meter_chaobiao:'抄表'},'self',this.callback)">总户数<br/>{{model.f_meter_yingchao}}户</button>
        <button style="width:130px;height:80px;" @click="$goto('state-yingchao',{f_meter_chaobiao:'已抄表'},'self',this.callback)">已抄户数<br/>{{model.f_meter_yichao}}户</button>
        <button style="width:130px;height:80px;" @click="$goto('state-yingchao',{f_meter_chaobiao:'未抄表'},'self',this.callback)">未抄户数<br/>{{model.f_meter_weichao}}户</button>
        <button style="width:130px;height:80px;" @click='showmassage()'>更多功能<br/>...</button>
    </div>
  </div>
</template>

<script>
import co from 'co'
import * as Util from '../Util'
import appData from '../../../src/components/appData'
import config from '../../../src/components/config'

let inputtorcount = function * (self) {
  let condition = `'${appData.loginUser.logininfo[0].f_bieming}'`
  console.log(appData.loginUser.logininfo);
  console.log(condition, 'condition');
  self.$resetpost(config.resultUrl + 'rs/sql/inputtorcount', {data: {condition: condition}},
  {resolveMsg: null, rejectMsg: null})
  .then ((res)=> {
    self.model.f_meter_yichao = res.data[0].bcount
    self.model.f_meter_weichao = res.data[0].acount
    self.model.f_meter_yingchao = res.data[0].ccount
  })
  .catch ((res)=> {
    self.$showMessage('获取任务失败，请查看你输入的查询信息')
  })
}
let back = function * (self) {

}
export default {
  title:'抄表任务',
  data(){
    return{
      model:{
        f_inputtor_name:'',
        f_fengongsi:'',
        f_meter_yichao:'',
        f_meter_weichao:'',
        f_meter_yingchao:''
      },
      userinfo: [],
      handplandata:[],
    }
  },
  methods: {
    // 具体计划查询
    information(row) {
      this.$goto('meter-userinfsearch', {rowdata: row})
  },
  showmassage () {
    this.$showMessage('更多功能,敬请期待!')
  },
  callback (){
    this.model.f_inputtor_name = appData.loginUser.logininfo[0].f_bieming
    this.model.f_fengongsi = appData.loginUser.logininfo[0].f_fengongsi
    let gen = inputtorcount(this)
    return co(gen)
  }
  },
  ready () {
    this.model.f_inputtor_name = appData.loginUser.logininfo[0].f_bieming
    this.model.f_fengongsi = appData.loginUser.logininfo[0].f_fengongsi
    let gen = inputtorcount(this)
    return co(gen)
  }
}
</script>
